# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer:
pkgname=libm4rie
pkgver=20200125
pkgrel=4
pkgdesc="Library for fast arithmetic with dense matrices over GF(2^e) for 2 <= e <= 16"
url="https://bitbucket.org/malb/m4rie"
arch="all"
license="GPL-2.0-or-later"
makedepends="libm4ri-dev"
source="https://bitbucket.org/malb/m4rie/downloads/m4rie-$pkgver.tar.gz
	0001-Fix-const-ptr-to-const-syntax.patch
	0002-no-more-access-to-the-rows-.-field-of-mzd_t-objects.patch
	0003-fix-reinstated-functions.patch
	"
subpackages="$pkgname-static $pkgname-dev"
builddir="$srcdir/m4rie-$pkgver"

prepare() {
	default_prepare
	update_config_sub
}

build() {
	export CFLAGS="${CFLAGS/-Os/-O3}" # gotta go fast

	./configure \
		--target="$CTARGET" \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--enable-openmp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
761ba9d8eeec381356b45d37a63bac9e70e2b1227435fb717d89a2358df610458fd4f7b7b4af90ad24c918bae81a25c926380761d2c514a762b92d8c661b52e7  m4rie-20200125.tar.gz
eabca92f3291c9b7fef99a6f4cba3b3c1e268f3f55dab6e96a44ae60b6c64d02160b641c585922943e3fcf716b0b84edf15936717bd8cad6d9dfcfffa7b6bd03  0001-Fix-const-ptr-to-const-syntax.patch
2b8071acf2e9d275e557f5663f0d9e6da1358c1ab0db8dcc7aa2bed122fe7014d003fd8d6aece2fc02c0ca23d8844fd507eb2c7053a370a498b3c84f89742ee7  0002-no-more-access-to-the-rows-.-field-of-mzd_t-objects.patch
02b6a4025ce6c9d05633a812d1d676ea145f60b786625243b9bb5296409ce3c50e86ad6b467c1d4c45bf244480bfc66accd246a1c4a8abafd2ff0b4e81a4a518  0003-fix-reinstated-functions.patch
"
